package com.tao.ai.controller;

import com.tao.ai.entity.Student;
import com.tao.ai.service.CourseService;
import com.tao.ai.service.StudentService;
import com.tao.ai.vo.CourseVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TeacherController {
    @Autowired
    private CourseService courseService;
    @Autowired
    private StudentService studentService;

    @RequestMapping("/courselist")
    public CourseVo courseList(Integer page, Integer limit, String ppuser){
        return courseService.getCourse(page,limit,ppuser);
    }

    @RequestMapping("/coursefindname")
    public CourseVo courseFindName(String ppuser){
        return courseService.getCourseName(ppuser);
    }

    @RequestMapping("/studentlist")
    public CourseVo studentList(Integer page, Integer limit, String courseName){
        return courseService.getStudentByCourse(page, limit, courseName);
    }

    @RequestMapping("/studentsign")
    public int studentSign(String courseName,Integer studentId){
        return studentService.signStudent(courseName,studentId);
    }

}
